@@ -147,6 +147,20 @@ angular.module('codexApp.index', [])
|
||
| 147 | 147 |
console.log("-> Copying URL to clipboard " + url);
|
| 148 | 148 |
clipboard.writeText(url); |
| 149 | 149 |
} })); |
| 150 |
+ menu.append(new MenuItem({ label: 'Delete', click: function () {
|
|
| 151 |
+ if(FileService.deleteFile(file.path)){
|
|
| 152 |
+ var index = $scope.files.indexOf(file); |
|
| 153 |
+ if (index > -1) {
|
|
| 154 |
+ if(!$scope.$$phase) {
|
|
| 155 |
+ $scope.$apply(function(){
|
|
| 156 |
+ $scope.files.splice(index, 1); |
|
| 157 |
+ }); |
|
| 158 |
+ } else {
|
|
| 159 |
+ $scope.files.splice(index, 1); |
|
| 160 |
+ } |
|
| 161 |
+ } |
|
| 162 |
+ }; |
|
| 163 |
+ } })); |
|
| 150 | 164 |
menu.popup(currentWindow); |
| 151 | 165 |
} |
| 152 | 166 |
|
@@ -392,6 +392,13 @@ angular.module('codexApp')
|
||
| 392 | 392 |
return filtered; |
| 393 | 393 |
} |
| 394 | 394 |
|
| 395 |
+ var deleteFile = function(file){
|
|
| 396 |
+ var fs = require('fs');
|
|
| 397 |
+ fs.unlinkSync(file); |
|
| 398 |
+ console.log('-> Successfully Deleted ' + file);
|
|
| 399 |
+ return true; |
|
| 400 |
+ } |
|
| 401 |
+ |
|
| 395 | 402 |
|
| 396 | 403 |
|
| 397 | 404 |
// RESPONSE |
@@ -476,4 +483,8 @@ angular.module('codexApp')
|
||
| 476 | 483 |
} |
| 477 | 484 |
} |
| 478 | 485 |
|
| 486 |
+ this.deleteFile = function(file) {
|
|
| 487 |
+ return deleteFile(file); |
|
| 488 |
+ } |
|
| 489 |
+ |
|
| 479 | 490 |
}]) |
@@ -1 +0,0 @@ |
||
| 1 |
-gjcjgcghj |